<script>
function state(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {

    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
	//alert(xmlhttp.responseText);
    }
  }
  
xmlhttp.open("GET","getcity.php?q="+str,true);
xmlhttp.send();
}


function cat(str)
{
	
if (str=="")
  {
	 
  document.getElementById("txtHint1").innerHTML="<select name='subcat'  style='width:220px;'><option>Select SubCategory</option></select>";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {

    document.getElementById("txtHint1").innerHTML=xmlhttp.responseText;
    }
  }
  
xmlhttp.open("GET","getsubcat.php?q="+str,true);
xmlhttp.send();
}
</script>
<style type="text/css">
#radientbox1 {
    -moz-border-radius-bottomright:5px;
	-moz-border-radius-topleft:5px;
	-webkit-border-bottom-right-radius:5px;
	-webkit-border-top-left-radius:5px;
	background-image:url(images/ProductListBgs1.jpg);
	background-repeat:repeat-x;
    /*background-image: -moz-linear-gradient(center bottom , #FFFFFF 15%, #E1F1FC 85%);
    border-color: #BFE7FF #BFE7FF -moz-use-text-color;*/
	border:2px solid #E4E4E4;
    height: auto;
    margin-top: 10px;
    padding-top: 1px;	
}
#radientbox {
    -moz-border-radius-bottomright:5px;
	-moz-border-radius-topleft:5px;
	-webkit-border-bottom-right-radius:5px;
	-webkit-border-top-left-radius:5px;
	/*background-image:url(images/ProductListBgs3.jpg);
	background-repeat:repeat-x;*/
    background-image: -moz-linear-gradient(center bottom , #FFFFFF 15%, #E1F1FC 85%);
    border-color: #BFE7FF #BFE7FF -moz-use-text-color;
	border:2px solid #BFE7FF;
    height: auto;
    margin-top: 10px;
    padding-top: 1px;	
}
.searchbg {
    background-image:url(images/search.png);
	background-repeat:no-repeat;
    height: 29px;
	border:0px;
	width:106px;
	cursor:pointer;
}
</style>
<script language="javascript">
function applyjobs()
{
	document.applyjob.method="post";
	document.applyjob.action="index.php?view=apply_job";
	document.applyjob.submit();
}

</script>
 <?

 
 $keyword=$_GET['keyword'];
 $id=$_GET['id'];
 $jid=$_GET['jid'];
 $subcat=$_GET['subcat'];
 $city=$_GET['city'];
 $submit=$_GET['submit'];

$searchstr='';

if($keyword!=='')
{
  $searchstr.=" and (job_desc like '%$keyword%' || company_name like '%$keyword%' || job_nature like '%$keyword%')";
}
if($id!='')
{
   $searchstr.=" and cat_id ='$id'";
}
if($jid!='')
{
   $searchstr.=" and zone_id ='$jid'";
}
if($subcat!='')
{
   $searchstr.=" and sub_cat_id ='$subcat'";
}
if($city!='')
{
   $searchstr.=" and city_id ='$city'";
}

$sql="select * from job_post  where active_status='1' ".$searchstr;
$sql=mysql_query($sql);
$count=mysql_num_rows($sql);
 ?>  
  
    <div class="contentwarp">
    
      <!-- Begin contentwarpMiddle -->
      <div class="contentwarpMiddle">
         <div id="content" style="background-color:#FFF;float:left;width:900px; padding-left:20px; border:0px solid #CCC;">  
       <div>
	     <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
	       <tr>
	         <td width="28%" align="center" valign="top">
             <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" style="margin-top:40px;" id="radientbox">
	   <form action="index.php" id="layout" method="get" name="searchfrm">
	   <input type="hidden" name="page" value="jobs">
	   <input type="hidden" name="view" value="view_ad_search">
	   <tr>
	     <td height="30" align="left" valign="middle" class="font12" style="font-size:14px; font-weight:bold;">
         FIND JOBS</td>
	     </tr>
	   <tr><td align="center" valign="middle">
       <input type="text" value="<?=$_GET['keyword']?>" class="searchborder" style="width:210px;" name="keyword" ></td>
	   </tr>
	   <tr>
	     <td align="center" valign="middle">
         <select name="id" id="Category" class="searchborder" style="width:220px;" onchange="return cat(this.value)">
	       <option value="">Select Category</option>
	       <?php  
		$ads=mysql_query("select * from job_category where active_status='1' order by id ASC");
		while($tech=mysql_fetch_array($ads)){
			?>
	       <option <?php if($_GET['id']==$tech['id']){echo "selected";}?> value="<?php echo $tech['id']?>"> <?php echo $tech['category']?></option>
	       <?php }?>
	       </select></td>
	     </tr>
	   <tr>
	     <td align="center" valign="middle">
         <select name="jid" id="zone" class="searchborder" style="width:220px;" onchange="return state(this.value)"  >
	       <option value="">Select Zone </option>
	       <?php 
	
	
$ads=mysql_query("select * from zone where active_status='1' order by id ASC");
while($tech=mysql_fetch_array($ads)){
	
	?>
	       <option <?php if($_GET['jid']==$tech['id']){echo "selected";}?> value="<?php echo $tech['id']?>"> <?php echo $tech['zone_name']?></option>
	       <?php }?>
	       </select></td>
	     </tr>
	   <tr>
	   <!-- <td><input type="submit" value="keyword" name="keyword" onfocus="this.value='';" ></td> -->
	   <td align="center" valign="middle">
	     <div id="txtHint1">
	       <select name="subcat" class="searchborder" style="width:220px;"> 
	         <option value="">--Select SubCategory--</option>
	         <?php 
			
		 $ads=mysql_query("select * from job_subcategory where 	id='".$_GET['id']."' and active_status='1' order by id ASC");
		while($tech=mysql_fetch_array($ads)){
			
			?> 
	         
	         
	         <option  <?php if($_GET['subcat']==$tech['id']){echo "selected";}?> value="<?php echo $tech['id']?>">
	           <?php echo $tech['sub_cat_name'];?>
	           </option>  <?php }?>
	         </select>
	       </div>
	     </td>
	   </tr>
	   <tr>
	     <td align="center" valign="middle">
	       <div id="txtHint">
	         <select name="city" class="searchborder" style="width:220px;"  >
	           <option value="">--Select City--</option>
  <?php 
	
 $ads=mysql_query("select * from city where zone_id='".$_GET['jid']."' and active_status='1' order by city_id ASC");
while($tech=mysql_fetch_array($ads)){
	
	?>
	           <option <?php if($_GET['city']==$tech['city_id']){echo "selected";}?>  value="<?php echo  $tech['city_id'];?>">
	             <?php //echo $str;?>
	             <?php echo $tech['city_name'];?>
	             </option> 
	           <?php } ?>
	           </select>
	         </div>
	       </td>
	     </tr>
	   <tr>
	     <td align="right" valign="middle" style="padding-right:15px;">
         <input type="submit" value="" class="searchbg" name="submit" /></td>
	     </tr>
	   </form>
	   </table>
             </td>
	         <td width="1%" align="center" valign="top">&nbsp;</td>
	         <td width="71%" align="center" valign="top">
             <div>
       <form name="applyjob" method="post"> 
        <div class="contentArea1">
          <div class="browse-capital clearfix">
            <ul>
              <li>
    <?php 
	if($count>0)
	{
	?>
    <div class="font12" style="color:#333; margin:35px 0px 0px 20px; font-weight:bold; font-size:14px;" align="left";>
    <?php $tot = mysql_num_rows($sql);?>
    <span class="font12">Jobs matching "<?php echo $_GET['keyword']?>"</span><br /><br />
    <span style="font-weight:normal;" class="font12">
    Your job search found <b><?php echo $tot;?></b> Jobs matching "<b><?=$_GET['keyword']?></b>".</span>
    </div>
	<?php
	while($tech=mysql_fetch_array($sql))
	 {?>
        <div style="height:160px; width:600px; margin-left:15px;" id="radientbox1">
        <table width="100%" border="0">
        <tr>
        	<td width="74%" height="25" align="left" valign="middle" style="color:#098BBB; text-transform:uppercase; font-weight:bold; font-size:14px;">
			<a href="index.php?page=jobs&view=apply_job&post_id=<?php echo $tech[id] ?>">
			<?php echo $tech[job_nature];?></a>
            </td>
        	<td width="26%" height="30" align="right" valign="middle" style="color:#333; font-weight:bold; font-size:14px;">
            <b>$ <?php  echo $tech[salary].'&nbsp;'.$tech[salary_type]; ?></b></td>
        </tr>
        <tr>
        <td height="90" align="left" valign="top" style="color:#333">
        <?php  echo substr($tech[job_desc],0,300).'.....'; ?></td>
        <td height="30" align="right" valign="top" style="color:#333">
        <?php $dateArray=explode('-',$tech[closing_date]);
		echo date('M j, Y', mktime(0, 0, 0, $dateArray[1], $dateArray[2], $dateArray[0])); ?>
        </td>
        </tr> 
         <tr>
        <td align="left" valign="bottom" style="color:#333" ><?php  echo $tech[company_name]; ?></td>
        <td align="right">&nbsp;</td></tr>
        </table>
        </div>
	 <?php }
	}
	else
	{
	?>
	<tr>
        <td style="color:#A7A7A7" colspan="2" >
        	No Record Found with this search criteria.
            
            
        </td>
        </tr> 
	<?
	}
    ?>
              </li>
            </ul>
          </div>
        </div>
       <div align="center">
           <!-- <input type="image" src="images/apply-selected-job.png" />-->
            <input type="hidden" name="process" id="process" value=""/>
            <input type="hidden" name="module" id="module" value="applyjob"/>
            </div></form>
      <!-- Define wide ad unit. "google_afs_request_done" function populates ads.-->
    </div>
             </td>
           </tr>
	       <tr>
	         <td align="center" valign="top">&nbsp;</td>
	         <td align="center" valign="top">&nbsp;</td>
	         <td align="center" valign="top">&nbsp;</td>
           </tr>
         </table>
	   
	  </div>
      
      </div>
      <!-- End contentwarpMiddle -->
      
        
      
      <!-- End contentwarp -->
      <div style="clear:both;"></div>
    </div> <?php //include("includes/right_content.php");?>
    <!-- End mainWarpArea -->
    <div style="clear:both;"></div>

